package zzxkj.blog.dao;


import cn.hutool.core.date.DateTime;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import zzxkj.blog.dto.*;
import zzxkj.blog.pojo.Blog;

import java.util.List;

/**
 * Mapper
 * @author zzxkj
 */
@Repository
public interface BlogDao {

    ShowBlog getBlogById(Long id);

    List<BlogQuery> getAllBlogQuery(AdminSearchParam param);

    int saveBlog(Blog blog);

    int deleteBlog(Long id);

    int updateBlog(Blog blog);

    int saveBlogAndTag(BlogAndTag blogAndTag);

    int deleteBlogAndTag(Long blogId);

    FirstPageBlog getOneFirstBlog(Long id);

    List<FirstPageBlog> getFirstPageBlog();

    List<RecommendBlog> getAllRecommendBlog();

    List<RecommendBlog> listRecommendBlogTop(Integer size);

    List<FirstPageBlog> getSearchBlog(String query);

    DetailedBlog getDetailedBlog(Long id);

    List<FirstPageBlog> getByTypeId(Long typeId);

    List<FirstPageBlog> getByTagId(Long tagId);

    List<String > findGroupYear();

    List<DetailedBlog> findByYear(String year);

    List<BlogRankInfo> get7Days(DateTime time);

    Long countBlog();

    Integer increaseView(Long id);

    Integer batchIncreaseView(@Param("blogRankInfos") List<BlogRankInfo> blogRankInfos);

    List<BlogRankInfo> getListInIds(@Param("ids") List<String>ids);

    Integer getNowDayViews();

    Integer dayViewInit();

    List<Object> getDayViewsOf7Days();

    Integer increaseDayViews(@Param("increaseViews") Integer increaseViews);

    Integer updateDayViews(@Param("nowViews") Integer nowViews);

    TotalCountOfAll getTotalCountOfAll();

}
